﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace CollectionInfo {
	public partial class Info : UserControl {
		public Info() {
			InitializeComponent();
		}
		public string VantageID {
			get { return (string)GetValue(VantageIDProperty); }
			set { SetValue(VantageIDProperty, value); }
		}

		// Using a DependencyProperty as the backing store for VantageID.  This enables animation, styling, binding, etc...
		public static readonly DependencyProperty VantageIDProperty =
				DependencyProperty.Register("VantageID", typeof(string), typeof(Info), new PropertyMetadata(VantageIDChangedCallback));

		static void VantageIDChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e) {
			var p = d as Info;
			if (p == null) throw new Exception(d.GetType().FullName + " is not " + typeof(Info).FullName);
			var dc = p.DataContext as CollectionInfoModel;
			if (dc == null) throw new Exception(p.DataContext.GetType().FullName + " is not " + typeof(CollectionInfoModel).FullName);
			dc.VantageID = e.NewValue + "";
		}
	}
}
